import java.util.Scanner;

public class Text3 {
    public static void main(String[] args) {
        Scanner sca = new Scanner(System.in);
        int n = sca.nextInt();
        fun(n);
    }
    public static void fun(int n){
        if(n <= 9){
            System.out.println(n);
            return;
        }
        fun(n/10);
        System.out.println(n%10);
    }
}
